<?php

namespace App\Models;

use App\Services\CommonService;
use App\Services\EducationService;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Testing\Fluent\Concerns\Has;

class MemberLegal extends Model
{
     use HasFactory;
    protected $table = 'sp_member_legal';
    protected $primaryKey = 'id';
    public $timestamps = false;
    //查询地区信息


    public static function query($cert_no)
    {
         $res=self::where('cert_no',$cert_no)
            ->first();
        return obToArray($res);

    }

    public static function insertMemberLegal($cert_no,$cert_name,$mobile,$uid,$is_legal,$result)
    {

        $res= self::where('cert_no',$cert_no)->value('id');
        if($res){
            return ReturnMsg(CommonService::HTTP_CODE_FAIL, '此用户已查询');
        }
        $data=['cert_no'=>$cert_no,'cert_name'=>$cert_name,'mobile'=>$mobile,'uid'=>$uid,'is_legal'=>$is_legal,'result'=>$result,'create_time'=>time()];

        return self::insert($data);

    }



}
